import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/index.vue";

Vue.use(VueRouter);

const routes = [
  // 首页
  {
    path: "/",
    name: "home",
    redirect:'/dashboard',
    component: HomeView,
    children: [
      // 关于页面
      {
        path: "about",
        name: "about",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/about.vue"),
      },
      // 分类页面
      {
        path: "sort",
        name: "sort",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/sort.vue"),
      },
      //房产经纪
      {
        path: "realtor",
        name: "realtor",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/realtor.vue"),
      },
      //房产详情
      {
        path: "detail",
        name: "detail",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/detail.vue"),
      },
      // 地产列表
      {
        path: "list",
        name: "list",
        component: () =>
          import(/* webpackChunkName: "about" */ "../views/list.vue"),
      },
      // 首页
      {
        path: "dashboard",
        name: "dashboard",
        component: () => import("@/views/dashboard.vue"),
      },
      {
        path: "realtorDetail",
        name: "realtorDetail",
        component: () => import("@/views/realtordetail.vue"),
      },
    ],
  },
  {
    path: "*",
    component: () => import("@/views/404.vue"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
